/**
 * @create 2022-04-24
 * @desc fetcher
 */
import { getSearchTable, GetSearchTableRequest, GetSearchTableRListItem } from '@src/api';
import { FetcherType } from '@src/components/pro-table';

export const fetcher: FetcherType<GetSearchTableRListItem, GetSearchTableRequest> = async (
  params,
) => {
  const { pagination, ...rest } = params;
  const { data } = await getSearchTable({
    start: pagination?.current,
    limit: pagination?.pageSize,
    ...rest,
  });

  return {
    data: data.list,
    total: data.total,
  };
};
